class LNode {
    constructor(element) {
        this.element = element;
        this.pre = null
        this.next = null;
    }
}

class LList {
    constructor() {
        let node = new LNode('head');
        this.head = node;
        this.end = node;
    }
    add(node) {
        let temp = this.end;
        node.pre = temp;
        temp.next = node;
        this.end = node;
    }

    remove(node) {
        let preNode = node.pre;
        let nextNode = node.next;
        if (nextNode) {
            preNode.next = nextNode;
            nextNode.pre = preNode;
        } else {
            preNode.next = null;
        }
    }
}

export {
    LNode,
    LList
}